<template>
  <div class="liegoodlist">
    <div class="title">
      {{title}}
      <div> <van-icon name="more-o"  /></div>
    </div>
    <div ref="wrapper" class="lie_goods_f">
      <div v-bind:style="{width: width + 'px' }"  class="lie_goods">
        <div class="good" v-for='item in goods'>
          <div @click="goInfo(item.id)" class="items">
            <div class="img">
              <img :src="item.img">
            </div>
            <div class="name">{{item.name}}</div>
            <div class="prize">￥{{item.prize}}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import Bscroll from 'better-scroll'
  export default {
    name: "lie-goodslist",
    props: {
      title: String,
      goods: Array,
    },
    data(){
      return{
        width: 0
      }
    },
    methods: {
      goInfo(v) {
        // console.log(v)
        this.$router.push({path: '/category/uid?='+v})
      }
    },
    mounted() {
      this.width=this.goods.length * 140
      this.$nextTick(() => {
        this.scroll = new Bscroll(this.$refs.wrapper, {
          click: true,
          scrollX:true,
          scrollY:false,
          eventPassthrough:'vertical'
        })
      })
    }
  }
</script>

<style lang="less" scoped>
  .img{
    width: 130px;
    height: 140px;
    overflow: hidden;
    background-color: @_grey;
    line-height: 140px;
  }
  .img img{
    width: 100%;
    height: auto;

  }
  .liegoodlist {
    background-color: #fff;
    width: 100%;
    clear: both;
    padding-top: 12px;
    height: 250px;
  }

  .liegoodlist .title {
    height: 18px;
    line-height: 18px;
    color: @_blk;
    font-size: 18px;
    border-left: 3px solid @_green;
    margin-bottom: 12px;
    position: relative;
  }
  .lie_goods_f{
    padding-left: 5px;
    padding-right: 5px;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
  }
  .good{
    float: left;
    width: 130px;
    margin: 0 5px;
  }
  .name{
    text-align: center;
    line-height: 22px;
    margin: 10px 0;
  }
  .title div{
    float: right;
    height: 20px;
    width: 20px;
    margin-right: 5px;
  }
  .prize{
    color: @_red;
    text-align: center;
  }
</style>
